<?php

namespace app\admin\services;

use app\admin\model\MenuModel;

class MenuService extends BaseService
{
    public function list($param = [], $field = [])
    {
        $menuModel = MenuModel::makeInstance();
        $list = $menuModel->list($param, $field);
        return $list;
    }

    public function save($param = [], $id = 0)
    {
        $menuModel = MenuModel::makeInstance();
        if ($id == 0) {
            $res = $menuModel->mInsert($param);
        } else {
            $res = $menuModel->mUpdate($param, $id);
        }
        return $res;
    }

    public function getInfoById($id, $param = [])
    {
        $menuModel = MenuModel::makeInstance();
        return $menuModel->getInfoById($id, $param);
    }
}